home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 November / Chip_2004-11_cd1.bin / zkuste / planetaria / download / celestia / celestia-win32-1.3.2.exe / {app} / shaders / eclipse1_nv.fp < prev    next >
Encoding:
Text File  |  2004-03-04  |  692 b   |  30 lines

  1. !!FP1.0
  2.  
  3. # Eclipse shadow shader--this shader computes a black circle centered
  4. # at texcoord (0.5, 0.5) and multiplies this by texture zero and the
  5. # diffuse color.
  6.  
  7. # Parameters:
  8. # p[5]  - ambient light color
  9. # p[20] - shadow umbra/penumbra parameters (x = scale, y = bias)
  10.  
  11. # Compute the square of the distance from the center of the shadow
  12. SUB R0, f[TEX0], { 0.5, 0.5, 0, 0 };
  13. DP3 R1.w, R0, R0;
  14.  
  15. # Scale and bias the squared distance to get the right shadow umbra
  16. # and penumbra sizes.
  17. MAD_SAT R1.x, R1.w, p[20].x, p[20].y;
  18.  
  19. #MUL R0.xyz, R1.x, 2.0;
  20. POW R0.xyz, R1.x, 0.5;
  21. #TEX R0.xyz, R1.x, TEX0, 2D;
  22.  
  23. # Add the ambient light
  24. ADDX_SAT R0.xyz, R0, p[5];
  25.  
  26. # Output it
  27. MOVX o[COLR], R0;
  28.  
  29. END
  30.